a = input()
l = input().split()
q = input().split()


class Node:
    def __init__(self, item):
        self.item = item
        self.next = None


class Array:
    def __init__(self):
        self.head = None

    def append(self, item):
        if not self.head:
            self.head = Node(item)
            return
        cur = self.head
        while cur.next:
            cur = cur.next
        cur.next = Node(item)

    def consult(self, num):
        cout = 0
        cur = self.head
        cout += 1
        while cur:
            if num == str(cout):
                print(cur.item)
                return
            cur = cur.next
            cout += 1


if __name__ == '__main__':
    s = Array()
    for i in l:
        s.append(i)
    for j in q:
        s.consult(j)